﻿<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title>Hello MUI</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">

		<!--标准mui.css-->
		<link rel="stylesheet" href="../../css/mui.min.css">
		<link rel="stylesheet" href="../../css/global.css">
		<!--App自定义的css-->
		<link rel="stylesheet" type="text/css" href="../../css/app.css" />
		<script src="../../js/getURLParam.js"></script>
		<style>
		.chart {
				height: 200px;
				margin: 0px;
				padding: 0px;
			}
		</style>
	</head>
	<body class="bodyback">
		<div style="margin-top: 0;" class="mui-content">
			<form class="mui-input-group fongtstyle" style="margin-top: 10px;">
				<div class="mui-input-row">
					<label for="">设备号：</label>
					<input type="text" id="vclnum" readonly="true" value="" style="color:grey"/>
				</div>
				<div class="mui-input-row">
					<label for="">所属机构：</label>
					<input type="text" id="dbname" readonly="true" value="" style="color:grey"/>
				</div>
				<div class="mui-input-row">
					<label for="">发动机号：</label>
					<input type="text" id="vclesnnum" readonly="true" value="" style="color:grey"/>
				</div>
				<div class="mui-input-row">
					<label for="">底盘号：</label>
					<input type="text" id="ChassisNumber" readonly="true" value="" style="color:grey"/>
				</div>
				<div class="mui-input-row">
					<label for="">生产厂家：</label>
					<input type="text" id="facName" readonly="true" value="" style="color:grey"/>
				</div>
				<div class="mui-input-row">
					<label for="">设备型号：</label>
					<input type="text" id="vclType" readonly="true" value="" style="color:grey"/>
				</div>
				<div class="mui-input-row">
					<label for="">发动机型号：</label>
					<input type="text" id="esnType" readonly="true" value="" style="color:grey"/>
				</div>
				<div class="mui-input-row">
					<label for="">驱动类型：</label>
					<input type="text" id="vcldrivertype" readonly="true" value="" style="color:grey"/>
				</div>
				<div class="mui-input-row">
					<label for="">车辆联系人：</label>
					<input type="text" id="vcluser" value=""/>
				</div>
				<div class="mui-input-row">
					<label for="">电话：</label>
					<input type="text" id="vclphone" value=""/>
				</div>
			</form>
			
		<div>
			<div class="mui-content-padded" style="margin-top: 10px;margin-right: 0px;margin-left: 0px;">
				<button type="button" class="mui-btn mui-btn-block mui-btn-primary" onclick="saveS()" >保存</button>
			</div>
		<script src="../../js/mui.min.js"></script>
		<script src="../../libs/echarts-all.js"></script>
		<script type="text/javascript" charset="utf-8">
			mui.init({
				swipeBack: true //启用右滑关闭功能
			});
			var sessionid=GetQueryString("sessionid");
			var accountid=GetQueryString("accountid");
	        var proversion=GetQueryString("proversion");
	        var vclid=GetQueryString("vclid");
	         (function($) {
				mui.ajax('../../../APP/vclInfoMaint', {
					data: {
						param: '{"proVersion":"' + proversion + '","accountId":"' + accountid + '","sessionid":"' + sessionid + '","data":{"vclId":"' + vclid + '","type":"0"}}'
					},
					dataType: 'jsonp', //服务器返回json格式数据
					type: 'post', //HTTP请求类型
					timeout: 100000, //超时时间设置为10秒；
					success: function(data) {
						var jsonObj = window.JSON.parse(data);
						if (jsonObj.resultCode == "1") {
							//获取返回数据的data
							document.getElementById("vclnum").value=jsonObj.data.vclnum;
							document.getElementById("dbname").value=jsonObj.data.dbname;
					        document.getElementById("vclesnnum").value=jsonObj.data.esnnum;
					        document.getElementById("ChassisNumber").value=jsonObj.data.chassisnumber;
					         document.getElementById("facName").value=jsonObj.data.facname ; 
					        document.getElementById("vclType").value=jsonObj.data.vcltype;
					         document.getElementById("esnType").value=jsonObj.data.esntype; 
					        document.getElementById("vcldrivertype").value=jsonObj.data.drivetype ;
					        document.getElementById("vcluser").value=jsonObj.data.vehiclecontact;
					        document.getElementById("vclphone").value=jsonObj.data.vehiclechargedmobile;
						} else {
							mui.toast(jsonObj.resultCode)
						}
					},
					error: function(xhr, type, errorThrown) {
						mui.toast("err")
					}
				});
			})(mui);
	        //设备号、发动机号、后桥速比、驱动类型、联系人、电话
			function saveS(){
				//mui.toast("save");
				var vcluser = document.getElementById("vcluser").value;
				var phone = document.getElementById("vclphone").value;
				var pattern = /^\d+$/;
				if(phone!=""&&phone!=null&&!pattern.test(phone)){
					mui.toast("请输入数字")
					return false;
				}
				//ajax请求获取单车档案信息
				mui.ajax('../../../APP/vclInfoMaint', {
					data: {
						param: '{"proVersion":"' + proversion + '","accountId":"' + accountid + '","sessionid":"' + sessionid + '","data":{"vclId":"' + vclid + '","VehicleContact":"'+vcluser+'","VehicleChargedMobile":"'+phone+'","type":"1"}}'
					},
					dataType: 'jsonp', //服务器返回json格式数据
					type: 'post', //HTTP请求类型
					timeout: 100000, //超时时间设置为10秒；
					conTentType:"application/xwww-form-urlencoded;charset=utf-8",
					success: function(data) {
						var jsonObj = window.JSON.parse(data);
						if (jsonObj.resultCode == "1") {
							mui.toast("保存成功");
							window.webkit.messageHandlers.vclsingleEditSave.postMessage("1");
						}else{
							mui.toast("保存失败")
						}
					},
					error: function(xhr, type, errorThrown) {
						mui.toast("err")
					}
				});
			}
		</script>
	</body>

</html>